<!--  -->
<template>
  <div>
   <ETable v-bind="tableConifg">
      <template #search="{params,search}">

  
        <el-form :inline="true"  class="demo-form-inline">

     
<el-form-item label="机构名称">
    <el-input v-model="params.name" placeholder="Approved by" clearable />
 </el-form-item>

 <el-form-item label="管理员名字">
    <el-input v-model="params.adminName" placeholder="Approved by" clearable />
 </el-form-item>
<el-form-item>
<el-button type="primary" @click="search">搜索</el-button>
</el-form-item>
</el-form>
      </template>

      <template #buttons="{ delAll }">
        <el-button v-permission="3"   type="primary" @click="add()">添加</el-button>
        <el-button  v-permission="239"  type="danger" @click="delAll">批量删除</el-button>
     </template>
    
     <template #operation="{ row,del }">
        <el-button v-permission="4"  link type="primary" @click="edit(row.id)">修改</el-button>
        <el-button v-permission="239"  link type="danger" @click="del(row.id)">删除</el-button>
     </template>
   </ETable>
  </div>
</template>

<script lang='ts' setup>
import { reactive,toRefs,ref,onMounted} from 'vue'
import ETable, { TableType } from '../../components/ETable.vue';
import { getCompanys,delCompany,delCompanys } from '../../apis/company/company';
import router from '../../router';
const value1 = ref('')
 
const tableConifg:TableType = {
    loadData:getCompanys,
    columns: [
        { prop: 'id', label: 'ID' },
        { prop: 'name', label: '机构名称' },
        { prop: 'adminName', label: '管理员名字' },
        { prop: 'address', label: '机构地址' },
        {prop: 'operation',slot:true, label: '操作', width: "200"}
     ],
     delelte:delCompany,
     delelteAll:delCompanys
}
const add=()=>{
 
   router.push("/company/add")
}   
const edit=(id:number)=>{
   router.push("/company/edit/"+id)
}
</script>
<style scoped>
</style>